﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using DAL;
using System.Configuration;
using System.IO;
using System.Windows.Forms;

namespace BLL
{
    public class DatabaseFunc
    {
        public static CheckConnection CheckConn;
        public delegate void CheckConnection(System.Data.ConnectionState state);

        public System.Data.ConnectionState CheckState()
        { 
            DatabaseService sv = new DatabaseService();
            var state = sv.CheckConnection();
            return state;
        }


        public void SetConnection()
        {
            System.Configuration.Configuration config =
                 ConfigurationManager.OpenExeConfiguration
                            (System.Windows.Forms.Application.ExecutablePath);
            Dictionary<string, string> setting = new Dictionary<string, string>();
            foreach (var item in config.AppSettings.Settings.AllKeys)
            {
                setting.Add(item, config.AppSettings.Settings[item].Value);
            }
            DatabaseService sv = new DatabaseService();
            sv.GetConfig(setting);
        }


    }
}
